wayland/gl: Use the GdkGLContext options
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 28 Jan 2015 12:29:37 +0000 (12:29 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 9 Feb 2015 19:10:05 +0000 (19:10 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=741946

gdk/wayland/gdkglcontext-wayland.c

index a5fa5df356034cdbf201f2e82cc239099376a8a6..88d32232f4b2375795c82d095ab8daa84d5fda80 100644 (file)
@@ -110,14 +110,34 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
   GdkGLProfile profile = gdk_gl_context_get_profile (context);
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
   EGLContext ctx;
-  EGLint context_attribs[3];
+  EGLint context_attribs[16];
   int i;
 
   i = 0;
   if (profile == GDK_GL_PROFILE_3_2_CORE)
     {
+      int major, minor, flags;
+      gboolean debug_bit, forward_bit;
+
+      gdk_gl_context_get_required_version (context, &major, &minor);
+      debug_bit = gdk_gl_context_get_debug_enabled (context);
+      forward_bit = gdk_gl_context_get_forward_compatible (context);
+
+      flags = 0;
+
+      if (debug_bit)
+        flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+      if (forward_bit)
+        flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
+
       context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
       context_attribs[i++] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
+      context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+      context_attribs[i++] = major;
+      context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+      context_attribs[i++] = minor;
+      context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
+      context_attribs[i++] = flags;
     }
   context_attribs[i++] = EGL_NONE;